public class Player {
	private String		name;
	private int			direction, health, kills, deaths, streak;
	private Position	position;
	private Weapon		weapon;

	public Player( String aName, int aHealth, int x, int y ) {
		name = aName;
		health = aHealth;
		kills = deaths = streak = 0;
		position = new Position( x, y );
	}

	public Player( String aName, int aHealth ) {
		this( aName, aHealth, 0, 0 );
	}

	public String toString() {
		return name + ":" + health + "," + kills + "," + deaths + "," + streak;
	}

	public String getName() {
		return name;
	}

	public int getDirection() {
		return direction;
	}

	public int getHealth() {
		return health;
	}

	public int getKills() {
		return kills;
	}

	public int getDeaths() {
		return deaths;
	}

	public int getStreak() {
		return streak;
	}

	public Position getPosition() {
		return position;
	}

	public double getX() {
		return position.getX();
	}

	public double getY() {
		return position.getY();
	}

	public Weapon getWeapon() {
		return weapon;
	}

	public String getKillDeathRatio() {
		if( deaths == 0 )
			return Integer.toString( kills );
		return String.format( "%.2f", ( kills / deaths ) ); // TODO format
	}

	public void moveY( double d ) {
		position.increaseY( d );
	}

	public void moveX( double by ) {
		position.increaseX( by );
	}

	public void turnRight( int by ) {
		direction += by;
	}

	public void turnLeft( int by ) {
		direction -= by;
	}

	public void moveBackward() {
		calculateMovement( direction - 180 );
	}

	public void moveForward() {
		calculateMovement( direction );
	}

	private void calculateMovement( int direction ) {
		double newDirection = Math.toRadians( direction + 90 );
		moveY( Math.sin( newDirection ) );
		moveX( Math.cos( newDirection ) );
	}

	public void setWeapon( Weapon weapon ) {
		this.weapon = weapon;
	}

	public void shoot() {
		new Bullet( new Position( position.getX(), position.getY() ), direction, weapon.getDamage() ); // TODO
		System.out.println( "shoot" );
	}

}